<?php
//强制设置页面编码为UTF-8
header("Content-type: text/html; charset=utf-8");
error_reporting(0);
//设置公共数据参数
define("_PATH_", dirname(__DIR__));
$config = include _PATH_ . '/conf/config.php';
include _PATH_ . '/common/function.php';
include _PATH_ . '/common/HttpClient.class.php';
//POST数据
$post = $_POST;
$_POST = null;
$config['pk'] = rsa_ges($config['public_key'], 'public');
$config['rk'] = rsa_ges($config['private_key'], 'private');

/**
 * 日志记录方法
 * @param $msg
 * @param string $level DEBUG,INFO,WARN,ERR
 * @return bool
 */
function logUtil($msg,$level="INFO"){

    $cost_mem = memory_usage();
    $log = "[{$level}][".date('Y-m-d H:i:s')."][{$cost_mem}]\t{$msg}\n";
    echo $log;
    unset($log);
}


function memory_usage() {
    $memory     = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB';
    return $memory;
}